﻿using System.ServiceModel;

namespace WebApi2.WebServices
{
    [ServiceContract]
    public interface IContract
    {
        /// <summary>
        /// 查询学生信息
        /// </summary>
        /// <param name="sno">学号</param>
        /// <returns>学生信息</returns>
        [OperationContract]
        StudentModel Get(string sno);
        /// <summary>
        /// 添加学生信息
        /// </summary>
        /// <param name="student">学生信息</param>
        /// <returns>result</returns>
        [OperationContract]
        int Add(StudentModel student);
    }
    public class StudentService : IContract
    {
        public StudentModel Get(string sno)
        {
            return new StudentModel() { Sno = sno, Name = "小红", Grade = "202002", Birthday = new DateTime(2012, 8, 15) };
        }
        /// <summary>
        /// 添加学生信息
        /// </summary>
        /// <param name="student"></param>
        /// <returns></returns>
        public int Add(StudentModel student)
        {
            return 1;
        }
    }
}
